import { SmeltMaterialItem } from "./cell/SmeltMaterialItem";
import { GImageBitmap } from "../../../../com/mui/controls/GImageBitmap";
import { ObjCreate } from "../common/ObjCreate";
import { Language } from "../../../../extend/language/Language";
import { GlobalStyle } from "../../../common/global/GlobalStyle";
import { GlobalClass } from "../../../../com/mui/core/GlobalClass";
import { ImagesConst } from "../../resource/ImagesConst";
import { SmeltMaterialItemData } from "./data/SmeltMaterialItemData";
import { HTMLUtil } from "../../../../com/gengine/utils/HTMLUtil";
import { GLabel } from "../../../../com/mui/controls/GLabel";
import { Vector } from "../../../../__AS3__/vec/Vector";
type int = number;
//class SmeltMaterialPanel
    
    export  class SmeltMaterialPanel /* flash.display.Sprite */
    {
        constructor()
        {
            
            this._materialItems = new Vector.<SmeltMaterialItem>();
            this.createChildren();
            return;
        }

        protected createChildren(): void
        {
            var loc3=null;
            var loc4=null;
            var loc1=0;
            while (loc1 < 6) 
            {
                (loc4 = new SmeltMaterialItem()).x = 73 + loc1 % 3 * 110;
                loc4.y = 10 + int(loc1 / 3) * 84;
                this.addChild(loc4);
                this._materialItems.push(loc4);
                ++loc1;
            }
            var loc2=new GImageBitmap("Smelt_totleSuccessRate.swf", 140, 75);
            this.addChild(loc2);
            this._successRateLabel = ObjCreate.createLabel("0%", 244, 75, 100, 25, flash.text.TextFormatAlign.LEFT, this, true, 16776960);
            ObjCreate.createLabel(Language.getString(69224), 156, 155, 100, 20, flash.text.TextFormatAlign.LEFT, this, false, 16761600);
            this._costLabel = ObjCreate.createLabel("", 221, 155, 50, 20, flash.text.TextFormatAlign.LEFT, this, false, GlobalStyle.color1Uint);
            loc3 = GlobalClass.getBitmap(ImagesConst.Tongqian);
            loc3.x = 255;
            loc3.y = 155;
            this.addChild(loc3);
            return;
        }

        public setMaterials(arg1: Array<any>): void
        {
            var loc1=0;
            while (loc1 < this._materialItems.length) 
            {
                if (arg1.length > loc1) 
                {
                    this._materialItems[loc1].setData(arg1[loc1] as SmeltMaterialItemData);
                }
                else 
                {
                    this._materialItems[loc1].setData(null);
                }
                ++loc1;
            }
            return;
        }

        public setSuccessRate(arg1: int): void
        {
            this._successRateLabel.htmlText = arg1 + "%";
            return;
        }

        public setCost(arg1: int, arg2: Boolean): void
        {
            var loc1=arg2 ? GlobalStyle.color1 : "#FF0000";
            this._costLabel.htmlText = HTMLUtil.addColor(String(arg1), loc1);
            return;
        }

        /* internal */ /* var */_materialItems: Vector.<SmeltMaterialItem>;

        /* internal */ /* var */_successRateLabel: GLabel;

        /* internal */ /* var */_costLabel: GLabel;
    }
